/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.examenes.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

import com.isn.logueo.entity.Usuario;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "detalle_ordenexamen")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DetalleOrdenexamen.findAll", query = "SELECT d FROM DetalleOrdenexamen d"),
    @NamedQuery(name = "DetalleOrdenexamen.findByResExa", query = "SELECT d FROM DetalleOrdenexamen d WHERE d.resExa = :resExa"),
    @NamedQuery(name = "DetalleOrdenexamen.findByFechaResExa", query = "SELECT d FROM DetalleOrdenexamen d WHERE d.fechaResExa = :fechaResExa"),
    @NamedQuery(name = "DetalleOrdenexamen.findByNumOe", query = "SELECT d FROM DetalleOrdenexamen d WHERE d.detalleOrdenexamenPK.numOe = :numOe"),
    @NamedQuery(name = "DetalleOrdenexamen.findByCodExa", query = "SELECT d FROM DetalleOrdenexamen d WHERE d.detalleOrdenexamenPK.codExa = :codExa"),
    @NamedQuery(name = "DetalleOrdenexamen.findByTipOpe", query = "SELECT d FROM DetalleOrdenexamen d WHERE d.tipOpe = :tipOpe")})
public class DetalleOrdenexamen implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected DetalleOrdenexamenPK detalleOrdenexamenPK;
    @Column(name = "Res_Exa")
    private String resExa;
    @Column(name = "Fecha_Res_Exa")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaResExa;
    @Column(name = "tip_ope")
    private String tipOpe;
    @JoinColumn(name = "Usuario", referencedColumnName = "Usuario")
    @ManyToOne
    private Usuario usuario;
    @JoinColumn(name = "Num_Oe", referencedColumnName = "Num_Oe", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private OrdenDeExamenes ordenDeExamenes;
    @JoinColumn(name = "Cod_Exa", referencedColumnName = "Cod_Exa", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Examen examen;

    public DetalleOrdenexamen() {
    }

    public DetalleOrdenexamen(DetalleOrdenexamenPK detalleOrdenexamenPK) {
        this.detalleOrdenexamenPK = detalleOrdenexamenPK;
    }

    public DetalleOrdenexamen(String numOe, String codExa) {
        this.detalleOrdenexamenPK = new DetalleOrdenexamenPK(numOe, codExa);
    }

    public DetalleOrdenexamenPK getDetalleOrdenexamenPK() {
        return detalleOrdenexamenPK;
    }

    public void setDetalleOrdenexamenPK(DetalleOrdenexamenPK detalleOrdenexamenPK) {
        this.detalleOrdenexamenPK = detalleOrdenexamenPK;
    }

    public String getResExa() {
        return resExa;
    }

    public void setResExa(String resExa) {
        this.resExa = resExa;
    }

    public Date getFechaResExa() {
        return fechaResExa;
    }

    public void setFechaResExa(Date fechaResExa) {
        this.fechaResExa = fechaResExa;
    }

    public String getTipOpe() {
        return tipOpe;
    }

    public void setTipOpe(String tipOpe) {
        this.tipOpe = tipOpe;
    }

    public Usuario getUsuario() {
        return usuario;
    }

    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }

    public OrdenDeExamenes getOrdenDeExamenes() {
        return ordenDeExamenes;
    }

    public void setOrdenDeExamenes(OrdenDeExamenes ordenDeExamenes) {
        this.ordenDeExamenes = ordenDeExamenes;
    }

    public Examen getExamen() {
        return examen;
    }

    public void setExamen(Examen examen) {
        this.examen = examen;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (detalleOrdenexamenPK != null ? detalleOrdenexamenPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleOrdenexamen)) {
            return false;
        }
        DetalleOrdenexamen other = (DetalleOrdenexamen) object;
        if ((this.detalleOrdenexamenPK == null && other.detalleOrdenexamenPK != null) || (this.detalleOrdenexamenPK != null && !this.detalleOrdenexamenPK.equals(other.detalleOrdenexamenPK))) {
            return false;
        }
        return true;
    }

}
